<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initSessionStart(){        
        Zend_Session::start();               
    }    
    protected function _initTimezone(){
        date_default_timezone_set('America/Bogota');
    }
    protected function _initMyDb() { 
              
        $this->bootstrap('multidb');
        $resource = $this->getPluginResource('multidb');
        
        $resource->init();      
        
        $db1 = $resource->getDb('db1');
        $db2 = $resource->getDb('db2');
        
        //$defaultDb = $resource->getDb();
        
        //$resource = $this->getPluginResource('multidb');
        //$db2 = $resource->getDefaultDb();
        
       // $db1 = $resource->getDefaultDb();
        //$null = $resource->getDefaultDb(false);
       // $defaultDb = $resource->getDefaultDb();
        //$db1->query('SET CHARACTER SET \'UTF8\'');
        //$db2->query('SET CHARACTER SET \'UTF8\'');
        Zend_Registry::set('db1', $db1);
        Zend_Registry::set('db2', $db2);

    }
    protected function _initViewHelpers()
    {
        $this->bootstrap("view");
        $view = $this->getResource('view');        
        $view->addHelperPath('My/View/Helper','My_View_Helper');        
    }
    protected function _initAutoloader(){
        $autoloader = Zend_Loader_Autoloader::getInstance();
        //$autoloader->registerNamespace('My_')->setFallbackAutoloader(true);
 
        $resourceAutoloader = new Zend_Loader_Autoloader_Resource(
        array(
                'basePath' => APPLICATION_PATH,
                'namespace' => '',
                'resourceTypes' => array(
                  'form' => array('path' => 'forms/', 'namespace' => 'Form'),
                  'model' => array('path' => 'models/', 'namespace' => 'Model')
                )
           )
        );
    }
    protected function _initFunctions(){
        Zend_Loader::loadFile('functions.php', APPLICATION_PATH.'/../library/My', true);
//        include_once(APPLICATION_PATH.'/../library/My/functions.php');
    }
}


?>